package com.ctsi.commons.util.crypto;

import com.ctsi.commons.util.GeneralException;

import javax.crypto.SecretKey;
import java.security.SecureRandom;

/**
 * 加解密小批量数据
 * 
 * @author yueming
 *
 */
public interface SymmetryCrypt {
	
	String getAlgorithm();
	
	String getTransformation();
	
	int getDeaultKeySize();

	SecretKey generateKey() throws Exception;

	SecretKey generateKey(int size, SecureRandom secr) throws Exception;

	byte[] encrypt(SecretKey key, byte[] bytes) throws GeneralException;

	byte[] encrypt(SecretKey key, byte[] bytes, int off, int len) throws GeneralException;

	byte[] decrypt(SecretKey key, byte[] bytes, int off, int len) throws GeneralException;

	byte[] decrypt(SecretKey key, byte[] bytes) throws GeneralException;
}